﻿#ifndef UAESENCRYPT_H
#define UAESENCRYPT_H

#include "../utkcore_global.h"

#include <QByteArray>
#include <QScopedPointer>

class UAESEncryptPrivate;
class UTKCORE_EXPORT UAESEncrypt
{
public:
    enum AESType {
        AES_128,
        AES_192,
        AES_256,
    };

    enum AESMode {
        AES_ECB,
        AES_CBC,
        AES_CFB,
        AES_OFB
    };

    enum AESPadding {
        AES_PKCS7,
        AES_ISO7816_4,
        AES_ANSI923,
        AES_ISO10126,
        AES_ZERO,
    };

    UAESEncrypt();
    UAESEncrypt(AESType type, AESMode mode, AESPadding padding);
    ~UAESEncrypt();

    QByteArray decrypt(QByteArray cyphertext, const QByteArray &key, const QByteArray &iv);

    QByteArray encrypt(QByteArray plaintext, const QByteArray &key, const QByteArray &iv);

    QString GetLastError();

private:
    QScopedPointer<UAESEncryptPrivate> d_ptr;
    Q_DECLARE_PRIVATE_D(d_ptr, UAESEncrypt)
};

#endif // UAESENCRYPT_H



